using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Miris.HumanMilkAnalyser.DataModel;

namespace Miris.HumanMilkAnalyser.Repository.EntityFramework.Mapping
{
    public class DiagnosticMessageReferenceMap : EntityTypeConfiguration<DiagnosticMessageReference>
    {
        public DiagnosticMessageReferenceMap()
        {
            // Primary Key
            this.HasKey(t => t.MessageTimestamp);

            // Properties
            this.Property(t => t.MessageTimestamp)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.MessageContent)
                .IsRequired()
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("DiagnosticMessageReference");
            this.Property(t => t.MessageTimestamp).HasColumnName("MessageTimestamp");
            this.Property(t => t.OrderIndex).HasColumnName("OrderIndex");
            this.Property(t => t.MessageContent).HasColumnName("MessageContent");
        }
    }
}
